#ifndef QQ_MASK_WIDGET
#define QQ_MASK_WIDGET

#include <qgraphicseffect.h>
#include <qgraphicsitem.h>
#include <qgraphicsscene.h>
#include <qpainter.h>
#include <qpropertyanimation.h>
#include <qwidget.h>

#include <stdafx.h>

class QQMaskWidget : public QWidget
{
	Q_OBJECT
		Q_PROPERTY(int mMaskAlpha READ getMaskAlpha WRITE setMaskAlpha NOTIFY maskAlphaChanged)
		Q_PROPERTY(int mMaskRadius READ getMaskRadius WRITE setMaskRadius NOTIFY maskRadiusChanged)
public:
	enum class MaskType
	{
		Normal,
		Vague
	};
public:
	explicit QQMaskWidget(QWidget* parent = nullptr, QQMaskWidget::MaskType type = QQMaskWidget::MaskType::Normal);
	~QQMaskWidget();
	void setMaskAlpha(int MaskAlpha);
	int getMaskAlpha() const;
	void setMaskRadius(int MaskRadius);
	int getMaskRadius() const;
	void setMaskType(QQMaskWidget::MaskType type);
	QQMaskWidget::MaskType getMaskType() const;
	void doMaskAnimation(int endValue);
signals:
	void maskAlphaChanged();
	void maskRadiusChanged();
protected:
	virtual void paintEvent(QPaintEvent* event) override;
private:
	int mMaskAlpha;
	int mMaskRadius;
	QQMaskWidget::MaskType mType;
	QGraphicsBlurEffect* mBlurEffect;
};

#endif // !QQ_MASK_WIDGET